import Vue from 'vue'
import Vuex from 'vuex'
import $api from '@/http/api.js'
Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		userInfo: ''
	},
	mutations: {
		GetUserInfo1(state, payload) {
			// console.log(state, payload);
			state.userInfo = payload
		}
	},
	actions: {
		getUserInfo1(context, data) {
			// console.log(context, data);
			$api.login.getUserInfo(data).then(a => {
					context.commit('GetUserInfo1', a[0])
				})
				.catch(b => {
					console.log(b);
				})
		}
	}


})

export default store
